#! /usr/bin/env python3

from check_ncd.problem import *
from check_ncd.search import *
from check_ncd.topo import *
import numpy

g = read_topology("Ibm.gml").simplify()
D = compute_demand(g, 3, 6, 1, uniform_generator, select_max_degree_vertices)
f = {(g.es[e].source, g.es[e].target) for e in {2, 6, 12}}

compute_weights_strategically(g, {})
loads = {(edge.source, edge.target):0 for edge in g.es}
dists = numpy.array(g.shortest_paths(weights="weight"))
SPG1 = {(s, t):compute_spg_strategically(g, D, dists, loads, s, t) for s, t in D}
loads = {(edge.source, edge.target):0 for edge in g.es}

compute_weights_strategically(g, {12})
dists = numpy.array(g.shortest_paths(weights="weight"))
SPG2 = {(s, t):compute_spg_strategically(g, D, dists, loads, s, t) for s, t in D}

for s, t in D:
	if SPG1[s, t]!=SPG2[s, t]:
		print (s, t, set(SPG1[s, t].keys()) & f)
		print (set(SPG2[s, t].keys()) & f)